*********** Replication code for "Citizenship and Surveys" **********************
*********** By Justin Gengler ***************************************************

***** Results Section *****************

* Total interviews by interviewer nationality 
mean qatari

* Differences in recruited respondent characteristics by interviewer nationality
* Education
ttest educall, by(qatari)

* Age and gender
ttest rage, by(qatari)
ttest female, by(qatari)

* Early termination and respondent category
logit dropoff rage
logit dropoff educall

***********************************************************
* Table 1: Early termination/Drop-off
* By t-test
ttest dropoff if workload>9, by(qatari)

* By CEM
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
logit dropoff i.qatari if workload>9 [pweight=cem_weights]
margins, dydx(qatari)

* Table 1: Total item nonresponse (completed interviews)
* By t-test
ttest refusedktotal if workload>9 & dropoff==0, by(qatari)

* By CEM
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
nbreg refusedktotal i.qatari if workload>9 & dropoff==0 [pweight=cem_weights]
margins, dydx(qatari)
margins, by(qatari)

*********************************************************
* Table 2: Total item nonresponse (completed interviews), diagnostics
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
eststo: quietly: nbreg  refusedktotal i.qatari if workload>9 & dropoff==0 [pweight=cem_weights]
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) comfort2 (0.5) if workload>9, treatment(qatari)
eststo: quietly: nbreg  refusedktotal i.qatari if workload>9 & dropoff==0 [pweight=cem_weights]
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) IMq (1.5 2.5) if workload>9, treatment(qatari)
eststo: quietly: nbreg  refusedktotal i.qatari if workload>9 & dropoff==0 [pweight=cem_weights]
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) IMq (1.5 2.5) comfort2 (0.5) if workload>9, treatment(qatari)
eststo: quietly: nbreg  refusedktotal i.qatari if workload>9 & dropoff==0 [pweight=cem_weights]
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) workload3 (1.5 2.5) if workload>9, treatment(qatari)
eststo: quietly: nbreg  refusedktotal i.qatari if workload>9 & dropoff==0 [pweight=cem_weights]
esttab using IFX.Table.2.Item.Nonresponse.by.CEM.Specification.rtf, title(Effects of conationality on total item nonresponse, by CEM specification) replace p pr2 star(+ 0.10 * 0.05 ** 0.01 *** 0.001) 
eststo clear

* finally, add mixed-effects to the table (colummn 6)
menbreg refusedktotal i.qatari age4 educ4 female if workload>9 & dropoff==0 || catiagent_new:

**********************************************************
* FIGURE 1: Early termination/drop-off, by interviewer conationality and Syrian vs. Sudanese
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9 & nat3only!=., treatment(qatari)
quietly: logit dropoff i.qatari if nat3only!=. & workload>9 [pweight=cem_weights]
quietly: margins, by(i.qatari) post
est store model1

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if qatari==0 & nat2!=. & workload>9, treatment(nat2)
quietly: logit dropoff i.nat2 if workload>9 [pweight=cem_weights]
quietly: margins, by(i.nat2) post
est store model2

coefplot (model1, label("Qatari")) (model2, label("Non-Qatari")), vert drop(0.qatari) ytitle("Probability of Early Termination") scheme(s1color) legend(title("Treatment Group",size(medium)))

* FIGURE 2: Total item nonresponse (completed interviews), by interviewer conationality and Syrian vs. Sudanese
cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9 & nat3only!=., treatment(qatari)
quietly: nbreg refusedktotal i.qatari if nat3only!=. & workload>9 & dropoff==0 [pweight=cem_weights]
quietly: margins, by(i.qatari) post
est store model1

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if qatari==0 & nat2!=. & workload>9, treatment(nat2)
quietly: nbreg refusedktotal i.nat2 if workload>9 & dropoff==0 [pweight=cem_weights]
quietly: margins, by(i.nat2) post
est store model2

coefplot (model1, label("Qatari")) (model2, label("Non-Qatari")), vert drop(0.qatari) ylab(1(.5)2.5) ytitle("Total Item Nonresponse Events") scheme(s1color) legend(title("Treatment Group",size(medium)))

**********************************************************
* Table 3. Effect of Interviewer Conationality on Sensitive Items: Economics  

* Qatar's economy
ttest qecon if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit qecon i.qatari if workload>9 [pweight=cem_weights]

* Respondent's household economy
ttest fecon if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit fecon i.qatari if workload>9 [pweight=cem_weights]

* Overall satisfaction with financial situation
ttest satis if satis<11 & workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
reg satis i.qatari if workload>9 & satis<11 [pweight=cem_weights]

**********************************************************
* Table 4. Effect of Interviewer Conationality on Sensitive Items: Inter-Communal Social Relations  

* Expats' right to salary increase
ttest increase if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit increase i.qatari if workload>9 [pweight=cem_weights]

* Hiring discrimination
ttest hired if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit hired i.qatari if workload>9 [pweight=cem_weights]

* Opening new places of worship for non-Muslims
ttest places if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit places i.qatari if workload>9 [pweight=cem_weights]

* Granting citizenship for those lived in Qatar 25+ years
ttest citizens if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit citizens i.qatari if workload>9 [pweight=cem_weights]

* Number of foreigners in Qatar
ttest foreigners if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit foreigners i.qatari if workload>9 [pweight=cem_weights]

* Trust in Arab expats
ttest trust_arab if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit trust_arab i.qatari if workload>9 [pweight=cem_weights]

* Trust in Western expats
ttest trust_west if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit trust_west i.qatari if workload>9 [pweight=cem_weights]

* Trust in Indian subcontinent expats
ttest trust_ind if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit trust_ind i.qatari if workload>9 [pweight=cem_weights]

* Newly naturalized people represent Qatar
ttest represent if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit represent i.qatari if workload>9 [pweight=cem_weights]

* People of foreign ancestry can never truly be Qatari
ttest ancestry if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit ancestry i.qatari if workload>9 [pweight=cem_weights]

* Naturalization laws in Qatar should be relaxed
ttest immig if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit immig i.qatari if workload>9 [pweight=cem_weights]

* Aggregate inter-communal measure
* Create aggregate measure, recoding variables to be on 1-4 scale
gen increase4 = increase*(4/3) 
gen hired34 = hired*(4/3)
gen foreign4 = foreign*(4/5)
egen combined4 = rowmean(increase4 hired34 places citizens foreign4 trust_arab trust_west trust_ind represent ancestry immig)
drop increase4 hired34 foreign4

ttest combined4 if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
reg combined4 i.qatari if workload>9 [pweight=cem_weights]

************************************************************
* APPENDIX A ***********************************************
* Table A1. Effect of Interviewer Conationality on Sensitive Items: Intra-Qatari Social Relations

* Trust in Qataris
ttest trust_qat if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit trust_qat i.qatari if workload>9 [pweight=cem_weights]

* Enforcing wearing of traditional Qatari female attire
ttest wear if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit wear i.qatari if workload>9 [pweight=cem_weights]

* Granting citizenship to children of Qatari mothers
ttest mothers if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit mothers i.qatari if workload>9 [pweight=cem_weights]

* Forbidding women from driving
ttest drive if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit drive i.qatari if workload>9 [pweight=cem_weights]

* Agree with coed campuses
ttest coed if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit coed i.qatari if workload>9 [pweight=cem_weights]

* Removing traditional Qatari female attire while abroad
ttest abaya if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit abaya i.qatari if workload>9 [pweight=cem_weights]

* Self-reported social conservatism
ttest conserv if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
ologit conserv i.qatari if workload>9 [pweight=cem_weights]

* Self-reported religious conservatism
ttest fajr if workload>9, by(qatari)

cem age4 (1.5 2.5 3.5) female (0.5) educ4 (1.5 2.5 3.5) if workload>9, treatment(qatari)
reg fajr i.qatari if workload>9 [pweight=cem_weights]
